/**
 * @name: LoginUserMessage
 * @Description:
 * @Author: 方琦
 * @Date: 2022/8/17 14:08
 **/
import React, {useState} from 'react';
import {inject, observer} from "mobx-react";
import avatar from "../../assets/images/avatar/avatar1.jpg";
import "../../assets/fonts/iconfont.css"
import userMsg from "./loginUserMessage.module.css";
import SmallWindow from "../model/SmallWindow";

function LoginUserMessage(props) {
    const [userInfo, setUserInfo] = useState(props.userStore.userInfo)
    const {data} = userInfo
    const [isShow, setIsShow] = useState(true)
    const modelConfig = {
        visible: isShow,
        closeModal: () => {
            setIsShow(false)
            props.menuStore.isDisplayStartMenu = false;
        }
    }
    return (
        <SmallWindow {...modelConfig} title="个人资料" width="280px" top="10px" right="10px">
            <div>
                <table className={userMsg.userTable}>
                    <tbody>
                    <tr>
                        <td rowSpan="4">
                            <img src={avatar} alt="用户头像"/>
                            <div className={userMsg.updateBtn}>
                                <span className="iconfont icon-biji_notes"></span>
                                <span>修改资料</span>
                            </div>
                        </td>
                        <td>姓名</td>
                        <td>{data[0].user_information.user_name}</td>
                    </tr>
                    <tr>
                        <td>部门</td>
                        <td>{data[0].user_information.department}</td>
                    </tr>
                    <tr>
                        <td>职务</td>
                        <td>{data[1].role_information[0].role_title}</td>
                    </tr>
                    <tr>
                        <td>电话</td>
                        <td>{data[0].user_information.phone_number?data[0].user_information.phone_number:""}</td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </SmallWindow>
    )
}

export default inject("menuStore", "userStore")(observer(LoginUserMessage))
